<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
	List<Map> list = QBuilder.db("basedb").select("new map(id as id, title as title, template_id as template_id, show_order as show_order, status as status, json as json)").from("visit_point").query().getResultObj();
	Map<Integer, Integer> order = new HashMap<Integer, Integer>();
	for (int i = 0; i < list.size(); i ++) {
		Map map = list.get(i);
		Integer id = Tools.getInt(map.get("template_id")+"", 0);
		Integer count = order.get(id);
		if (count == null) {
			order.put(id, 0);
		}
		count = order.get(id);
		count++;
		order.put(id, count);
		map.put("show_order", count);
		
	}
	DBTools.db("basedb").modItem("visit_point", list);
	out.println(list);
%>